package com.demo.word2html.poi.support.office2007;

import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
import lombok.extern.slf4j.Slf4j;
import org.apache.xmlbeans.XmlObject;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;

import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * @author fenggang.li
 * @create 2019-09-11 13:52
 */
@RequiredArgsConstructor
@Slf4j
public class CTRPrProxy implements CTRPr {
    @Delegate(types = XmlObject.class)
    private final CTRPr target;

    /**
     * 字体名集合
     */
    private static final Set<String> FONT_NAME_SET = initFontNameSet();

    @Override
    public CTFonts getRFonts() {
        CTFonts rFonts = target.getRFonts();
        if (Objects.isNull(rFonts)) {
            log.debug("font is null");
        } else if (FONT_NAME_SET.contains(rFonts.getAscii())) {
            log.debug("Keep {} as is.", rFonts.getAscii());
        } else {
            log.debug("Filter font \"{}\" with ascii name \"{}\"", rFonts.getClass().getName(), rFonts.getAscii());
            rFonts = new RFontProxy(rFonts, "SimSun");
        }
        return rFonts;
    }

    public static Set<String> initFontNameSet() {
        Set<String> fontNameSet = new HashSet<>();
        fontNameSet.add("DengXian Light");
        fontNameSet.add("SimSun");
        return Collections.unmodifiableSet(fontNameSet);
    }

    @Override
    public CTString getRStyle() {
        return target.getRStyle();
    }

    @Override
    public boolean isSetRStyle() {
        return target.isSetRStyle();
    }

    @Override
    public void setRStyle(CTString ctString) {
        target.setRStyle(ctString);
    }

    @Override
    public CTString addNewRStyle() {
        return target.addNewRStyle();
    }

    @Override
    public void unsetRStyle() {
        target.unsetRStyle();
    }

    @Override
    public boolean isSetRFonts() {
        return target.isSetRFonts();
    }

    @Override
    public void setRFonts(CTFonts ctFonts) {
        target.setRFonts(ctFonts);
    }

    @Override
    public CTFonts addNewRFonts() {
        return target.addNewRFonts();
    }

    @Override
    public void unsetRFonts() {
        target.unsetRFonts();
    }

    @Override
    public CTOnOff getB() {
        return target.getB();
    }

    @Override
    public boolean isSetB() {
        return target.isSetB();
    }

    @Override
    public void setB(CTOnOff ctOnOff) {
        target.setB(ctOnOff);
    }

    @Override
    public CTOnOff addNewB() {
        return target.addNewB();
    }

    @Override
    public void unsetB() {
        target.unsetB();
    }

    @Override
    public CTOnOff getBCs() {
        return target.getBCs();
    }

    @Override
    public boolean isSetBCs() {
        return target.isSetBCs();
    }

    @Override
    public void setBCs(CTOnOff ctOnOff) {
        target.setBCs(ctOnOff);
    }

    @Override
    public CTOnOff addNewBCs() {
        return target.addNewBCs();
    }

    @Override
    public void unsetBCs() {
        target.unsetBCs();
    }

    @Override
    public CTOnOff getI() {
        return target.getI();
    }

    @Override
    public boolean isSetI() {
        return target.isSetI();
    }

    @Override
    public void setI(CTOnOff ctOnOff) {
        target.setI(ctOnOff);
    }

    @Override
    public CTOnOff addNewI() {
        return target.addNewI();
    }

    @Override
    public void unsetI() {
        target.unsetI();
    }

    @Override
    public CTOnOff getICs() {
        return target.getICs();
    }

    @Override
    public boolean isSetICs() {
        return target.isSetICs();
    }

    @Override
    public void setICs(CTOnOff ctOnOff) {
        target.setICs(ctOnOff);
    }

    @Override
    public CTOnOff addNewICs() {
        return target.addNewICs();
    }

    @Override
    public void unsetICs() {
        target.unsetICs();
    }

    @Override
    public CTOnOff getCaps() {
        return target.getCaps();
    }

    @Override
    public boolean isSetCaps() {
        return target.isSetCaps();
    }

    @Override
    public void setCaps(CTOnOff ctOnOff) {
        target.setCaps(ctOnOff);
    }

    @Override
    public CTOnOff addNewCaps() {
        return target.addNewCaps();
    }

    @Override
    public void unsetCaps() {
        target.unsetCaps();
    }

    @Override
    public CTOnOff getSmallCaps() {
        return target.getSmallCaps();
    }

    @Override
    public boolean isSetSmallCaps() {
        return target.isSetSmallCaps();
    }

    @Override
    public void setSmallCaps(CTOnOff ctOnOff) {
        target.setSmallCaps(ctOnOff);
    }

    @Override
    public CTOnOff addNewSmallCaps() {
        return target.addNewSmallCaps();
    }

    @Override
    public void unsetSmallCaps() {
        target.unsetSmallCaps();
    }

    @Override
    public CTOnOff getStrike() {
        return target.getStrike();
    }

    @Override
    public boolean isSetStrike() {
        return target.isSetStrike();
    }

    @Override
    public void setStrike(CTOnOff ctOnOff) {
        target.setStrike(ctOnOff);
    }

    @Override
    public CTOnOff addNewStrike() {
        return target.addNewStrike();
    }

    @Override
    public void unsetStrike() {
        target.unsetStrike();
    }

    @Override
    public CTOnOff getDstrike() {
        return target.getDstrike();
    }

    @Override
    public boolean isSetDstrike() {
        return target.isSetDstrike();
    }

    @Override
    public void setDstrike(CTOnOff ctOnOff) {
        target.setDstrike(ctOnOff);
    }

    @Override
    public CTOnOff addNewDstrike() {
        return target.addNewDstrike();
    }

    @Override
    public void unsetDstrike() {
        target.unsetDstrike();
    }

    @Override
    public CTOnOff getOutline() {
        return target.getOutline();
    }

    @Override
    public boolean isSetOutline() {
        return target.isSetOutline();
    }

    @Override
    public void setOutline(CTOnOff ctOnOff) {
        target.setOutline(ctOnOff);
    }

    @Override
    public CTOnOff addNewOutline() {
        return target.addNewOutline();
    }

    @Override
    public void unsetOutline() {
        target.unsetOutline();
    }

    @Override
    public CTOnOff getShadow() {
        return target.getShadow();
    }

    @Override
    public boolean isSetShadow() {
        return target.isSetShadow();
    }

    @Override
    public void setShadow(CTOnOff ctOnOff) {
        target.setShadow(ctOnOff);
    }

    @Override
    public CTOnOff addNewShadow() {
        return target.addNewShadow();
    }

    @Override
    public void unsetShadow() {
        target.unsetShadow();
    }

    @Override
    public CTOnOff getEmboss() {
        return target.getEmboss();
    }

    @Override
    public boolean isSetEmboss() {
        return target.isSetEmboss();
    }

    @Override
    public void setEmboss(CTOnOff ctOnOff) {
        target.setEmboss(ctOnOff);
    }

    @Override
    public CTOnOff addNewEmboss() {
        return target.addNewEmboss();
    }

    @Override
    public void unsetEmboss() {
        target.unsetEmboss();
    }

    @Override
    public CTOnOff getImprint() {
        return target.getImprint();
    }

    @Override
    public boolean isSetImprint() {
        return target.isSetImprint();
    }

    @Override
    public void setImprint(CTOnOff ctOnOff) {
        target.setImprint(ctOnOff);
    }

    @Override
    public CTOnOff addNewImprint() {
        return target.addNewImprint();
    }

    @Override
    public void unsetImprint() {
        target.unsetImprint();
    }

    @Override
    public CTOnOff getNoProof() {
        return target.getNoProof();
    }

    @Override
    public boolean isSetNoProof() {
        return target.isSetNoProof();
    }

    @Override
    public void setNoProof(CTOnOff ctOnOff) {
        target.setNoProof(ctOnOff);
    }

    @Override
    public CTOnOff addNewNoProof() {
        return target.addNewNoProof();
    }

    @Override
    public void unsetNoProof() {
        target.unsetNoProof();
    }

    @Override
    public CTOnOff getSnapToGrid() {
        return target.getSnapToGrid();
    }

    @Override
    public boolean isSetSnapToGrid() {
        return target.isSetSnapToGrid();
    }

    @Override
    public void setSnapToGrid(CTOnOff ctOnOff) {
        target.setSnapToGrid(ctOnOff);
    }

    @Override
    public CTOnOff addNewSnapToGrid() {
        return target.addNewSnapToGrid();
    }

    @Override
    public void unsetSnapToGrid() {
        target.unsetSnapToGrid();
    }

    @Override
    public CTOnOff getVanish() {
        return target.getVanish();
    }

    @Override
    public boolean isSetVanish() {
        return target.isSetVanish();
    }

    @Override
    public void setVanish(CTOnOff ctOnOff) {
        target.setVanish(ctOnOff);
    }

    @Override
    public CTOnOff addNewVanish() {
        return target.addNewVanish();
    }

    @Override
    public void unsetVanish() {
        target.unsetVanish();
    }

    @Override
    public CTOnOff getWebHidden() {
        return target.getWebHidden();
    }

    @Override
    public boolean isSetWebHidden() {
        return target.isSetWebHidden();
    }

    @Override
    public void setWebHidden(CTOnOff ctOnOff) {
        target.setWebHidden(ctOnOff);
    }

    @Override
    public CTOnOff addNewWebHidden() {
        return target.addNewWebHidden();
    }

    @Override
    public void unsetWebHidden() {
        target.unsetWebHidden();
    }

    @Override
    public CTColor getColor() {
        return target.getColor();
    }

    @Override
    public boolean isSetColor() {
        return target.isSetColor();
    }

    @Override
    public void setColor(CTColor ctColor) {
        target.setColor(ctColor);
    }

    @Override
    public CTColor addNewColor() {
        return target.addNewColor();
    }

    @Override
    public void unsetColor() {
        target.unsetColor();
    }

    @Override
    public CTSignedTwipsMeasure getSpacing() {
        return target.getSpacing();
    }

    @Override
    public boolean isSetSpacing() {
        return target.isSetSpacing();
    }

    @Override
    public void setSpacing(CTSignedTwipsMeasure ctSignedTwipsMeasure) {
        target.setSpacing(ctSignedTwipsMeasure);
    }

    @Override
    public CTSignedTwipsMeasure addNewSpacing() {
        return target.addNewSpacing();
    }

    @Override
    public void unsetSpacing() {
        target.unsetSpacing();
    }

    @Override
    public CTTextScale getW() {
        return target.getW();
    }

    @Override
    public boolean isSetW() {
        return target.isSetW();
    }

    @Override
    public void setW(CTTextScale ctTextScale) {
        target.setW(ctTextScale);
    }

    @Override
    public CTTextScale addNewW() {
        return target.addNewW();
    }

    @Override
    public void unsetW() {
        target.unsetW();
    }

    @Override
    public CTHpsMeasure getKern() {
        return target.getKern();
    }

    @Override
    public boolean isSetKern() {
        return target.isSetKern();
    }

    @Override
    public void setKern(CTHpsMeasure ctHpsMeasure) {
        target.setKern(ctHpsMeasure);
    }

    @Override
    public CTHpsMeasure addNewKern() {
        return target.addNewKern();
    }

    @Override
    public void unsetKern() {
        target.unsetKern();
    }

    @Override
    public CTSignedHpsMeasure getPosition() {
        return target.getPosition();
    }

    @Override
    public boolean isSetPosition() {
        return target.isSetPosition();
    }

    @Override
    public void setPosition(CTSignedHpsMeasure ctSignedHpsMeasure) {
        target.setPosition(ctSignedHpsMeasure);
    }

    @Override
    public CTSignedHpsMeasure addNewPosition() {
        return target.addNewPosition();
    }

    @Override
    public void unsetPosition() {
        target.unsetPosition();
    }

    @Override
    public CTHpsMeasure getSz() {
        return target.getSz();
    }

    @Override
    public boolean isSetSz() {
        return target.isSetSz();
    }

    @Override
    public void setSz(CTHpsMeasure ctHpsMeasure) {
        target.setSz(ctHpsMeasure);
    }

    @Override
    public CTHpsMeasure addNewSz() {
        return target.addNewSz();
    }

    @Override
    public void unsetSz() {
        target.unsetSz();
    }

    @Override
    public CTHpsMeasure getSzCs() {
        return target.getSzCs();
    }

    @Override
    public boolean isSetSzCs() {
        return target.isSetSzCs();
    }

    @Override
    public void setSzCs(CTHpsMeasure ctHpsMeasure) {
        target.setSzCs(ctHpsMeasure);
    }

    @Override
    public CTHpsMeasure addNewSzCs() {
        return target.addNewSzCs();
    }

    @Override
    public void unsetSzCs() {
        target.unsetSzCs();
    }

    @Override
    public CTHighlight getHighlight() {
        return target.getHighlight();
    }

    @Override
    public boolean isSetHighlight() {
        return target.isSetHighlight();
    }

    @Override
    public void setHighlight(CTHighlight ctHighlight) {
        target.setHighlight(ctHighlight);
    }

    @Override
    public CTHighlight addNewHighlight() {
        return target.addNewHighlight();
    }

    @Override
    public void unsetHighlight() {
        target.unsetHighlight();
    }

    @Override
    public CTUnderline getU() {
        return target.getU();
    }

    @Override
    public boolean isSetU() {
        return target.isSetU();
    }

    @Override
    public void setU(CTUnderline ctUnderline) {
        target.setU(ctUnderline);
    }

    @Override
    public CTUnderline addNewU() {
        return target.addNewU();
    }

    @Override
    public void unsetU() {
        target.unsetU();
    }

    @Override
    public CTTextEffect getEffect() {
        return target.getEffect();
    }

    @Override
    public boolean isSetEffect() {
        return target.isSetEffect();
    }

    @Override
    public void setEffect(CTTextEffect ctTextEffect) {
        target.setEffect(ctTextEffect);
    }

    @Override
    public CTTextEffect addNewEffect() {
        return target.addNewEffect();
    }

    @Override
    public void unsetEffect() {
        target.unsetEffect();
    }

    @Override
    public CTBorder getBdr() {
        return target.getBdr();
    }

    @Override
    public boolean isSetBdr() {
        return target.isSetBdr();
    }

    @Override
    public void setBdr(CTBorder ctBorder) {
        target.setBdr(ctBorder);
    }

    @Override
    public CTBorder addNewBdr() {
        return target.addNewBdr();
    }

    @Override
    public void unsetBdr() {
        target.unsetBdr();
    }

    @Override
    public CTShd getShd() {
        return target.getShd();
    }

    @Override
    public boolean isSetShd() {
        return target.isSetShd();
    }

    @Override
    public void setShd(CTShd ctShd) {
        target.setShd(ctShd);
    }

    @Override
    public CTShd addNewShd() {
        return target.addNewShd();
    }

    @Override
    public void unsetShd() {
        target.unsetShd();
    }

    @Override
    public CTFitText getFitText() {
        return target.getFitText();
    }

    @Override
    public boolean isSetFitText() {
        return target.isSetFitText();
    }

    @Override
    public void setFitText(CTFitText ctFitText) {
        target.setFitText(ctFitText);
    }

    @Override
    public CTFitText addNewFitText() {
        return target.addNewFitText();
    }

    @Override
    public void unsetFitText() {
        target.unsetFitText();
    }

    @Override
    public CTVerticalAlignRun getVertAlign() {
        return target.getVertAlign();
    }

    @Override
    public boolean isSetVertAlign() {
        return target.isSetVertAlign();
    }

    @Override
    public void setVertAlign(CTVerticalAlignRun ctVerticalAlignRun) {
        target.setVertAlign(ctVerticalAlignRun);
    }

    @Override
    public CTVerticalAlignRun addNewVertAlign() {
        return target.addNewVertAlign();
    }

    @Override
    public void unsetVertAlign() {
        target.unsetVertAlign();
    }

    @Override
    public CTOnOff getRtl() {
        return target.getRtl();
    }

    @Override
    public boolean isSetRtl() {
        return target.isSetRtl();
    }

    @Override
    public void setRtl(CTOnOff ctOnOff) {
        target.setRtl(ctOnOff);
    }

    @Override
    public CTOnOff addNewRtl() {
        return target.addNewRtl();
    }

    @Override
    public void unsetRtl() {
        target.unsetRtl();
    }

    @Override
    public CTOnOff getCs() {
        return target.getCs();
    }

    @Override
    public boolean isSetCs() {
        return target.isSetCs();
    }

    @Override
    public void setCs(CTOnOff ctOnOff) {
        target.setCs(ctOnOff);
    }

    @Override
    public CTOnOff addNewCs() {
        return target.addNewCs();
    }

    @Override
    public void unsetCs() {
        target.unsetCs();
    }

    @Override
    public CTEm getEm() {
        return target.getEm();
    }

    @Override
    public boolean isSetEm() {
        return target.isSetEm();
    }

    @Override
    public void setEm(CTEm ctEm) {
        target.setEm(ctEm);
    }

    @Override
    public CTEm addNewEm() {
        return target.addNewEm();
    }

    @Override
    public void unsetEm() {
        target.unsetEm();
    }

    @Override
    public CTLanguage getLang() {
        return target.getLang();
    }

    @Override
    public boolean isSetLang() {
        return target.isSetLang();
    }

    @Override
    public void setLang(CTLanguage ctLanguage) {
        target.setLang(ctLanguage);
    }

    @Override
    public CTLanguage addNewLang() {
        return target.addNewLang();
    }

    @Override
    public void unsetLang() {
        target.unsetLang();
    }

    @Override
    public CTEastAsianLayout getEastAsianLayout() {
        return target.getEastAsianLayout();
    }

    @Override
    public boolean isSetEastAsianLayout() {
        return target.isSetEastAsianLayout();
    }

    @Override
    public void setEastAsianLayout(CTEastAsianLayout ctEastAsianLayout) {
        target.setEastAsianLayout(ctEastAsianLayout);
    }

    @Override
    public CTEastAsianLayout addNewEastAsianLayout() {
        return target.addNewEastAsianLayout();
    }

    @Override
    public void unsetEastAsianLayout() {
        target.unsetEastAsianLayout();
    }

    @Override
    public CTOnOff getSpecVanish() {
        return target.getSpecVanish();
    }

    @Override
    public boolean isSetSpecVanish() {
        return target.isSetSpecVanish();
    }

    @Override
    public void setSpecVanish(CTOnOff ctOnOff) {
        target.setSpecVanish(ctOnOff);
    }

    @Override
    public CTOnOff addNewSpecVanish() {
        return target.addNewSpecVanish();
    }

    @Override
    public void unsetSpecVanish() {
        target.unsetSpecVanish();
    }

    @Override
    public CTOnOff getOMath() {
        return target.getOMath();
    }

    @Override
    public boolean isSetOMath() {
        return target.isSetOMath();
    }

    @Override
    public void setOMath(CTOnOff ctOnOff) {
        target.setOMath(ctOnOff);
    }

    @Override
    public CTOnOff addNewOMath() {
        return target.addNewOMath();
    }

    @Override
    public void unsetOMath() {
        target.unsetOMath();
    }

    @Override
    public CTRPrChange getRPrChange() {
        return target.getRPrChange();
    }

    @Override
    public boolean isSetRPrChange() {
        return target.isSetRPrChange();
    }

    @Override
    public void setRPrChange(CTRPrChange ctrPrChange) {
        target.setRPrChange(ctrPrChange);
    }

    @Override
    public CTRPrChange addNewRPrChange() {
        return target.addNewRPrChange();
    }

    @Override
    public void unsetRPrChange() {
        target.unsetRPrChange();
    }

    @Override
    public String toString() {
        return target.toString();
    }
}
